import socket
from bdtime import tt

server_addr = ('192.168.2.12', 12345)
client_addr = ('', 1111)

def main():
    udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    udp.bind(client_addr)

    while 1:
        send_data = f'hahahha {tt.now(3)}'
        udp.sendto(send_data.encode('utf-8'), server_addr)

        print('~~~~~~', tt.now(1))

        tt.sleep(1)

        if tt.stop_alt('s'):
            break


    udp.close()

if __name__ == '__main__':
    main()